<template>
  <view class="search-container" :style="{'background-color': bgcolor}" @click="searchHandler">
    <view class="search-item" :style="{'border-radius': radius+'px'}">
      <uni-icons type="search" size="18"></uni-icons>
      <text>搜索</text>
    </view>
  </view>
</template>

<script>
  export default {
    name:"my-search",
    data() {
      return {
        
      };
    },
    props: {
      bgcolor: {
        type: String,
        default: '#ff00ff'
      },
      radius: {
        type: Number,
        default: 4
      }
    },
    methods: {
      searchHandler(){
        console.log('searchHandler 被点击了')
        this.$emit('gotoSearch')
        // uni.navigateTo({
        //   url: '/subpkg/search/search'
        // })
      }
    }
  }
</script>

<style lang="scss">
  .search-container {
    // background-color: #c00000;
    height: 50px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    
    .search-item {
      display: flex;
      justify-content: center;
      width: 100%;
      align-items: center;
      padding: 10rpx 0;
      margin: 0rpx 20rpx;
      // border-radius: 50px;
      background-color: #ffffff;
      
      text {
        margin-left: 16rpx;
      }
    }
  }
</style>
